#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#define NUM 1024

enum FLUSH_TYPE
{
    NONE_FLUSH = 0x0,
    LINE_FLUSH = 0x2,
    ALL_FLUSH = 0x4,
};

typedef struct MY_FILE
{
    int _fileno;//文件描述符
    int _flag;//访问方式

    char outbuf[NUM];//输出缓冲区
    int _ft;//输出缓冲区刷新策略
    int _outcur;//当前输出缓冲区中的字节个数(同时是当前首个空位的下标)
}MY_FILE;


MY_FILE* myfopen(const char* path,const char* mode);

size_t myfwrite(const void *ptr, size_t size, size_t nmemb, MY_FILE *stream);

int myfclose(MY_FILE* fp);

int myfflush(MY_FILE* fp);
